package Q2;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static int n;
    public static int aim;
    public static int[] arr;
    public static int minCount = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        n = scanner.nextInt();
        aim = scanner.nextInt();
        arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        Arrays.sort(arr);

        if (aim < arr[0]) {
            System.out.println(-1);
        }

        dfs(0, 0, 0);
        System.out.println(minCount == Integer.MIN_VALUE ? -1 : minCount);
    }

    public static void dfs(int index, int sum, int count) {
        if (sum == aim) {
            minCount = Math.min(minCount, count);
        }

        if (sum > aim || index == n) {
            return;
        }

        //依然使用这张货币
        dfs(index, sum + arr[index], count + 1);

        //不使用这张货币
        dfs(index + 1, sum, count);
    }
}
